#! /bin/env python3
# coding: utf-8
import os

import numpy as np
import pandas as pd

# sql content save to excel add sheet
def write_excel(file_path, sheet, header, data):
    excel_file = pd.ExcelWriter(file_path)
    if isinstance(data,tuple):
        df = pd.DataFrame.from_records(list(data))
    else:
        df = pd.DataFrame.from_records()
    df.to_excel(excel_file, index = False, header = header, sheet_name = sheet)
    excel_file.save()

def read_excel():
    pass

def write_csv(file_path,data):
    data = pd.DataFrame.from_records(data)
    data.to_csv(file_path, index=False, header = False)



if __name__ == "__main__":
    xls_path = r'd:\test.xls'
    data= (('00000013','嘉洲广场',11039,13109,1865),)
    sheet_name = u'中国'
    tab_header = ('subsystem_code', 'subsystem_name', 'park_in', 'park_out', 'order_num')
    write_excel(xls_path, sheet_name,tab_header, data)